﻿@*
    见这里的解释，如果通过 Routers 全局设置 rendermode ，则 Routes.Razor 必须放 CLient 根目录下。
https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0#apply-a-render-mode-to-the-entire-app

*@
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Routing
@using Beetle.Modules.BtAdminUI.Shared.Layouts;

<Router AppAssembly="typeof(Routes).Assembly"
        AdditionalAssemblies="new[]{typeof(Beetle.Modules.BtAdminUI.Shared._Imports).Assembly,typeof(Beetle.Modules.BtAdminUI.SsrServer.WebApplicationBuilderExtensions).Assembly, typeof(Beetle.Demo.SharedUI._Imports).Assembly}">
    <Found Context="routeData">
        @* <RouteView RouteData="routeData" DefaultLayout="typeof(Beetle.Modules.BtAdminUI.Shared.Layouts.MainLayout)" />
        <FocusOnNavigate RouteData="routeData" Selector="h1" /> *@
        <AuthorizeRouteView RouteData="@routeData"
                                DefaultLayout="@typeof(PageLayout)">
            <Authorizing>authorizing...</Authorizing>
            <NotAuthorized>
                <RedirectToLogin />
                <p>
                    You are not authorized to access
                    this resource.
                </p>
            </NotAuthorized>
        </AuthorizeRouteView>
    </Found>
    <NotFound>
        <LayoutView Layout="@typeof(PageLayout)">
            <p>Sorry, there's nothing at this address.</p>
        </LayoutView>
    </NotFound>
</Router>
